#include<stdio.h>
int main()
{
	int n,x, max = -999, min = 999;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		
		scanf("%d", &x);
		if (x < min)
			min = x;
		if (x > max)
			max = x;
	}
 
 
	printf("%d %d", min,max);
	return 0;
}
